<?php

class FormElements extends HTML  {
	private $attributeName;
	private $attributeType;
	private $attributeValue;
	
	const ATTRIBUTE_NAME = 'name';
	const ATTRIBUTE_TYPE = 'type';
	const ATTRIBUTE_VALUE = 'value';
	
	public function setFormElementsAttributes ($name, $type, $value)  {
		$this->attributeName = $name;
		$this->attributeType = $type;
		$this->attributeValue = $value;
	}
	
	public function setAttributeName ($name)  {
		$this->attributeName = $name;
	}
	
	public function setAttributeType ($type)  {
		$this->attributeType = $type;
	}
	
	public function setAttributeValue ($value)  {
		$this->attributeValue = $value;
	}
	
	public function getAttributeName ()  {
		return $this->attributeName;
	}
	
	public function getAttributeType ()  {
		return $this->attributeType;
	}
	
	public function getAttributeValue ()  {
		return $this->attributeValue;
	}

	public function getFormElementsAttributes ()  {
	
		$output = '';
	
		if (!empty($this->attributeName))  {
			$output .= ' '. self::ATTRIBUTE_NAME. '="'. $this->getAttributeName(). '"';
		}
		if (!empty($this->attributeType))  {
			$output .= ' '. self::ATTRIBUTE_TYPE. '="'. $this->getAttributeType(). '"';
		}
		if (!empty($this->attributeValue))  {
			$output .= ' '. self::ATTRIBUTE_VALUE. '="'. $this->getAttributeValue(). '"';
		}
	
		if ($output == '')  {
			$output = ' ';
		}
	
		return $output;
	}
	
	public static function getAttributes ()  {
		$attributes = array();
		$parentAttributes = parent::getAttributes();
		$attributes[] = self::ATTRIBUTE_NAME;
		$attributes[] = self::ATTRIBUTE_TYPE;
		$attributes[] = self::ATTRIBUTE_VALUE;
		
		return array_merge($parentAttributes, $attributes);
	}
}
?>